/**
 * 模拟每轮投票的结果
 */
#include <bits/stdc++.h>
using namespace std;


int N;
int M;
vector<int> A;

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int ans = 1;
    cin >> N >> M;
    A.assign(N + 1, 0);
    for(int x,i=0;i<M;++i){
        cin >> x;
        ++A[x];
        if(x == ans or A[x] > A[ans] or (A[x] == A[ans] and x < ans)){
            ans = x;
        }
        cout << ans << endl;
    }
    return 0;
}